package kylin.entity;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * <p>Class:AdminRolePower</p>
 * <p>Description: 后台角色权限关系表</p>
 * @author XQL
 * @Date 2015年9月16日 下午9:45:33
 */
@Entity
@Table(name="adminrolepower")
public class AdminRolePower {

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private int id;//id
	
	@ManyToOne
	@JoinColumn(name="roleid")
	private AdminRole role;//角色表
	
	@ManyToOne
	@JoinColumn(name="powerid")
	private AdminPower power;//权限表
	
	public AdminRolePower(){}

	public AdminRolePower(int id, AdminRole role, AdminPower power) {
		super();
		this.id = id;
		this.role = role;
		this.power = power;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public AdminRole getRole() {
		return role;
	}

	public void setRole(AdminRole role) {
		this.role = role;
	}

	public AdminPower getPower() {
		return power;
	}

	public void setPower(AdminPower power) {
		this.power = power;
	}

	@Override
	public String toString() {
		return "AdminRolePower [id=" + id + ", role=" + (role == null ? null : role.toString())
				+ ", power=" + (power == null ? null : power.toString()) + "]";
	}
	
}
